﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.ServiceModel.Channels;
using System.ServiceModel;

namespace WcfFlashRemoting.ServiceModel.Channels
{
    public static class AmfMessageVersions
    {
        //private static MessageVersion amf0 = MessageVersion.CreateVersion(EnvelopeVersion.None, AddressingVersion.None);
        //private static MessageVersion amf3 = MessageVersion.CreateVersion(EnvelopeVersion.None, AddressingVersion.None);

        //public static MessageVersion Amf0 { get { return amf0; } }
        //public static MessageVersion Amf3 { get { return amf3; } }

        //public static ushort GetVersionNumber(MessageVersion messageVersion)
        //{
        //    if ((object)messageVersion == (object)AmfMessageVersions.Amf0)
        //    {
        //        return 0;
        //    }
        //    else if ((object)messageVersion == (object)AmfMessageVersions.Amf3)
        //    {
        //        return 3;
        //    }
        //    else
        //    {
        //        throw new ArgumentException();
        //    }
        //}

        //internal static MessageVersion FromVersionNumber(ushort p)
        //{
        //    switch (p)
        //    {
        //        case 0:
        //            return Amf0;
        //        case 3:
        //            return Amf3;
        //        default:
        //            throw new ArgumentException();
        //    }
        //}

        public static bool VerifyAmfVersion(ushort version)
        {
            return version == 0 || version == 3;
        }
    }
}
